`:top
In `F33f`_`[recreational mathematics`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Recreational_mathematics]`_`f, a `!repunit`! is a `F33f`_`[number`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Number]`_`f like 11, 111, or 1111 that contains only the digit `F33f`_`[1`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=1_(number)]`_`f — a more specific type of `F33f`_`[repdigit`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Repdigit]`_`f. The term stands for "repeated unit" and was coined in 1966 by Albert H. Beiler in his book `*Recreations in the Theory of Numbers`*.`:cite-ref-2[`F5bf`_`[note 1`#cite-note-2]`_`f]
A `!repunit prime`! is a repunit that is also a `F33f`_`[prime number`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Prime_number]`_`f. Primes that are repunits in `F33f`_`[base-2`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Binary_number]`_`f are `F33f`_`[Mersenne primes`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Mersenne_prime]`_`f. As of October 2024, the `F33f`_`[largest known prime number`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Largest_known_prime_number]`_`f 2136,279,841 − 1, the largest `F33f`_`[probable prime`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Probable_prime]`_`f `*R`*8177207 and the largest `F33f`_`[elliptic curve primality`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Elliptic_curve_primality]`_`f-proven prime `*R`*86453 are all repunits in various bases.
>>Contents
• `F0af`_`[Definition`#definition]`_`f
• `F0af`_`[Properties`#properties]`_`f
• `F0af`_`[Factorization of decimal repunits`#factorization-of-decimal-repunits]`_`f
• `F0af`_`[Repunit primes`#repunit-primes]`_`f
• `F0af`_`[Decimal repunit primes`#decimal-repunit-primes]`_`f
• `F0af`_`[Algebra factorization of generalized repunit numbers`#algebra-factorization-of-generalized-repunit-numbers]`_`f
• `F0af`_`[The generalized repunit conjecture`#the-generalized-repunit-conjecture]`_`f
• `F0af`_`[History`#history]`_`f
• `F0af`_`[Demlo numbers`#demlo-numbers]`_`f
• `F0af`_`[See also`#see-also]`_`f
• `F0af`_`[Footnotes`#footnotes]`_`f
• `F0af`_`[Notes`#notes]`_`f
• `F0af`_`[References`#references]`_`f
• `F0af`_`[References`#references]`_`f
• `F0af`_`[External links`#external-links]`_`f
-─
>>Definition
The base-`*b`* repunits are defined as (this `*b`* can be either positive or negative)
R n ( b ) ≡ ≡ 1 + b + b 2 + ⋯ ⋯ + b n − − 1 = b n − − 1 b − − 1 for | b | ≥ ≥ 2 , n ≥ ≥ 1. {\\displaystyle R_{n}^{(b)}\\equiv 1+b+b^{2}+\\cdots +b^{n-1}={b^{n}-1 \\over {b-1}}\\qquad {\\mbox{for }}|b|\\geq 2,n\\geq 1.}
Thus, the number `*R`*`*n`*(`*b`*) consists of `*n`* copies of the digit 1 in base-`*b`* representation. The first two repunits base-`*b`* for `*n`* = 1 and `*n`* = 2 are
R 1 ( b ) = b − − 1 b − − 1 = 1 and R 2 ( b ) = b 2 − − 1 b − − 1 = b + 1 for | b | ≥ ≥ 2. {\\displaystyle R_{1}^{(b)}={b-1 \\over {b-1}}=1\\qquad {\\text{and}}\\qquad R_{2}^{(b)}={b^{2}-1 \\over {b-1}}=b+1\\qquad {\\text{for}}\\ |b|\\geq 2.}
In particular, the `*`F33f`_`[decimal`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Decimal]`_`f (base-`*10`*) repunits`* that are often referred to as simply `*repunits`* are defined as
R n ≡ ≡ R n ( 10 ) = 10 n − − 1 10 − − 1 = 10 n − − 1 9 for n ≥ ≥ 1. {\\displaystyle R_{n}\\equiv R_{n}^{(10)}={10^{n}-1 \\over {10-1}}={10^{n}-1 \\over 9}\\qquad {\\mbox{for }}n\\geq 1.}
Thus, the number `*R`*`*n`* = `*R`*`*n`*(10) consists of `*n`* copies of the digit 1 in base 10 representation. The sequence of repunits base-10 starts with
`F33f`_`[1`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=1_(number)]`_`f, `F33f`_`[11`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=11_(number)]`_`f, `F33f`_`[111`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=111_(number)]`_`f, 1111, 11111, 111111, ... (sequence A002275 in the `F33f`_`[OEIS`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=On-Line_Encyclopedia_of_Integer_Sequences]`_`f).
Similarly, the repunits base-2 are defined as
R n ( 2 ) = 2 n − − 1 2 − − 1 = 2 n − − 1 for n ≥ ≥ 1. {\\displaystyle R_{n}^{(2)}={2^{n}-1 \\over {2-1}}={2^{n}-1}\\qquad {\\mbox{for }}n\\geq 1.}
Thus, the number `*R`*`*n`*(2) consists of `*n`* copies of the digit 1 in base-2 representation. In fact, the base-2 repunits are the well-known `F33f`_`[Mersenne numbers`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Mersenne_prime]`_`f `*M`*`*n`* = 2`*n`* − 1, they start with
1, 3, 7, 15, 31, 63, 127, 255, 511, 1023, 2047, 4095, 8191, 16383, 32767, 65535, ... (sequence A000225 in the `F33f`_`[OEIS`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=On-Line_Encyclopedia_of_Integer_Sequences]`_`f).
>>Properties
• Any repunit in any base having a composite number of digits is necessarily composite. For example, `*R`*35(`*b`*) = 11111111111111111111111111111111111 = 11111 × 1000010000100001000010000100001 = 1111111 × 10000001000000100000010000001,
since 35 = 7 × 5 = 5 × 7. This repunit factorization does not depend on the base-`*b`* in which the repunit is expressed.
Only repunits (in any base) having a prime number of digits can be prime. This is a `F33f`_`[necessary but not sufficient condition`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Necessity_and_sufficiency]`_`f. For example, `*R`*11(2) = 211 − 1 = 2047 = 23 × 89.
• If `*p`* is an odd prime, then every prime `*q`* that divides `*R`*`*p`*(`*b`*) must be either 1 plus a multiple of 2`*p,`* or a factor of `*b`* − 1. For example, a prime factor of `*R`*29 is 62003 = 1 + 2·29·1069. The reason is that the prime `*p`* is the smallest exponent greater than 1 such that `*q`* divides `*bp`* − 1, because `*p`* is prime. Therefore, unless `*q`* divides `*b`* − 1, `*p`* divides the `F33f`_`[Carmichael function`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Carmichael_function]`_`f of `*q`*, which is even and equal to `*q`* − 1.
• Any positive multiple of the repunit `*R`*`*n`*(`*b`*) contains at least `*n`* nonzero digits in base-`*b`*.
• Any number `*x`* is a two-digit repunit in base x − 1.
• The only known numbers that are repunits with at least 3 digits in more than one base simultaneously are 31 (111 in base-5, 11111 in base-2) and 8191 (111 in base-90, 1111111111111 in base-2). The `F33f`_`[Goormaghtigh conjecture`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Goormaghtigh_conjecture]`_`f says there are only these two cases.
• Using the `F33f`_`[pigeon-hole principle`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Pigeon-hole_principle]`_`f it can be easily shown that for `F33f`_`[relatively prime`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Coprime_integers]`_`f natural numbers `*n`* and `*b`*, there exists a repunit in base-`*b`* that is a multiple of `*n`*. To see this consider repunits `*R`*1(`*b`*),...,`*R`*`*n`*(`*b`*). Because there are `*n`* repunits but only `*n`*−1 non-zero residues modulo `*n`* there exist two repunits `*R`*`*i`*(`*b`*) and `*R`*`*j`*(`*b`*) with 1 ≤ `*i`* < `*j`* ≤ `*n`* such that `*R`*`*i`*(`*b`*) and `*R`*`*j`*(`*b`*) have the same residue modulo `*n`*. It follows that `*R`*`*j`*(`*b`*) − `*R`*`*i`*(`*b`*) has residue 0 modulo `*n`*, i.e. is divisible by `*n`*. Since `*R`*`*j`*(`*b`*) − `*R`*`*i`*(`*b`*) consists of `*j`* − `*i`* ones followed by `*i`* zeroes, `*R`*`*j`*(`*b`*) − `*R`*`*i`*(`*b`*) = `*R`*`*j`*−`*i`*(`*b`*) × `*b`*`*i`*. Now `*n`* divides the left-hand side of this equation, so it also divides the right-hand side, but since `*n`* and `*b`* are relatively prime, `*n`* must divide `*R`*`*j`*−`*i`*(`*b`*).
• The `F33f`_`[Feit–Thompson conjecture`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Feit–Thompson_conjecture]`_`f is that `*R`*`*q`*(`*p`*) never divides `*R`*`*p`*(`*q`*) for two distinct primes `*p`* and `*q`*.
• Using the `F33f`_`[Euclidean Algorithm`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Euclidean_Algorithm]`_`f for repunits definition: `*R`*1(`*b`*) = 1; `*R`*`*n`*(`*b`*) = `*R`*`*n`*−1(`*b`*) × `*b`* + 1, any consecutive repunits `*R`*`*n`*−1(`*b`*) and `*R`*`*n`*(`*b`*) are relatively prime in any base-`*b`* for any `*n`*.
• If `*m`* and `*n`* have a common divisor `*d`*, `*R`*`*m`*(`*b`*) and `*R`*`*n`*(`*b`*) have the common divisor `*R`*`*d`*(`*b`*) in any base-`*b`* for any `*m`* and `*n`*. That is, the repunits of a fixed base form a `F33f`_`[strong divisibility sequence`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Divisibility_sequence]`_`f. As a consequence, If `*m`* and `*n`* are relatively prime, `*R`*`*m`*(`*b`*) and `*R`*`*n`*(`*b`*) are relatively prime. The Euclidean Algorithm is based on `*gcd`*(`*m`*, `*n`*) = `*gcd`*(`*m`* − `*n`*, `*n`*) for `*m`* > `*n`*. Similarly, using `*R`*`*m`*(`*b`*) − `*R`*`*n`*(`*b`*) × `*b`*`*m`*−`*n`* = `*R`*`*m`*−`*n`*(`*b`*), it can be easily shown that `*gcd`*(`*R`*`*m`*(`*b`*), `*R`*`*n`*(`*b`*)) = `*gcd`*(`*R`*`*m`*−`*n`*(`*b`*), `*R`*`*n`*(`*b`*)) for `*m`* > `*n`*. Therefore, if `*gcd`*(`*m`*, `*n`*) = `*d`*, then `*gcd`*(`*R`*`*m`*(`*b`*), `*R`*`*n`*(`*b`*)) = `*Rd`*(`*b`*).
>>Factorization of decimal repunits
(Prime factors (or prime powers) parenthesized and colored (red) are "new factors", i. e. the prime factor (or power) divides `*R`*`*n`* but does not divide `*R`*`*k`* for all `*k`* < `*n`*) (sequence A102380 in the `F33f`_`[OEIS`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=On-Line_Encyclopedia_of_Integer_Sequences]`_`f)`:cite-ref-3[`F5bf`_`[2`#cite-note-3]`_`f]
Smallest prime factor of `*R`*`*n`* for `*n`* > 1 are
11, 3, 11, 41, 3, 239, 11, 3, 11, 21649, 3, 53, 11, 3, 11, 2071723, 3, 1111111111111111111, 11, 3, 11, 11111111111111111111111, 3, 41, 11, 3, 11, 3191, 3, 2791, 11, 3, 11, 41, 3, 2028119, 11, 3, 11, 83, 3, 173, 11, 3, 11, 35121409, 3, 239, 11, ... (sequence A067063 in the `F33f`_`[OEIS`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=On-Line_Encyclopedia_of_Integer_Sequences]`_`f)
>>Repunit primes
The definition of repunits was motivated by recreational mathematicians looking for `F33f`_`[prime factors`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Integer_factorization]`_`f of such numbers.
It is easy to show that if `*n`* is divisible by `*a`*, then `*R`*`*n`*(`*b`*) is divisible by `*R`*`*a`*(`*b`*):
R n ( b ) = 1 b − − 1 ∏ ∏ d | n Φ Φ d ( b ) , {\\displaystyle R_{n}^{(b)}={\\frac {1}{b-1}}\\prod _{d|n}\\Phi _{d}(b),}
where Φ Φ d ( x ) {\\displaystyle \\Phi _{d}(x)} is the d t h {\\displaystyle d^{\\mathrm {th} }} `F33f`_`[cyclotomic polynomial`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Cyclotomic_polynomial]`_`f and `*d`* ranges over the divisors of `*n`*. For `*p`* prime,
Φ Φ p ( x ) = ∑ ∑ i = 0 p − − 1 x i , {\\displaystyle \\Phi _{p}(x)=\\sum _{i=0}^{p-1}x^{i},}
which has the expected form of a repunit when `*x`* is substituted with `*b`*.
For example, 9 is divisible by 3, and thus `*R`*9 is divisible by `*R`*3—in fact, 111111111 = 111 · 1001001. The corresponding cyclotomic polynomials Φ Φ 3 ( x ) {\\displaystyle \\Phi _{3}(x)} and Φ Φ 9 ( x ) {\\displaystyle \\Phi _{9}(x)} are x 2 + x + 1 {\\displaystyle x^{2}+x+1} and x 6 + x 3 + 1 {\\displaystyle x^{6}+x^{3}+1} , respectively. Thus, for `*R`*`*n`* to be prime, `*n`* must necessarily be prime, but it is not sufficient for `*n`* to be prime. For example, `*R`*3 = 111 = 3 · 37 is not prime. Except for this case of `*R`*3, `*p`* can only divide `*R`*`*n`* for prime `*n`* if `*p`* = 2`*kn`* + 1 for some `*k`*.
>>>Decimal repunit primes
`*R`*`*n`* is prime for `*n`* = 2, 19, 23, 317, 1031, 49081, 86453, 109297 ... (sequence A004023 in `F33f`_`[OEIS`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=OEIS]`_`f). On July 15, 2007, Maksym Voznyy announced `*R`*270343 to be probably prime.`:cite-ref-4[`F5bf`_`[3`#cite-note-4]`_`f] Serge Batalov and Ryan Propper found `*R`*5794777 and `*R`*8177207 to be probable primes on April 20 and May 8, 2021, respectively.`:cite-ref-5[`F5bf`_`[4`#cite-note-5]`_`f] As of their discovery, each was the largest known probable prime. On March 22, 2022, probable prime `*R`*49081 was eventually proven to be a prime.`:cite-ref-6[`F5bf`_`[5`#cite-note-6]`_`f] On May 15, 2023, probable prime `*R`*86453 was eventually proven to be a prime.`:cite-ref-7[`F5bf`_`[6`#cite-note-7]`_`f] On May 26, 2025, probable prime `*R`*109297 was eventually proven to be a prime.`:cite-ref-8[`F5bf`_`[7`#cite-note-8]`_`f]
It has been conjectured that there are infinitely many repunit primes`:cite-ref-9[`F5bf`_`[8`#cite-note-9]`_`f] and they seem to occur roughly as often as the `F33f`_`[prime number theorem`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Prime_number_theorem]`_`f would predict: the exponent of the `*N`*th repunit prime is generally around a fixed multiple of the exponent of the (`*N`*−1)th.
The prime repunits are a trivial subset of the `F33f`_`[permutable primes`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Permutable_prime]`_`f, i.e., primes that remain prime after any `F33f`_`[permutation`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Permutation]`_`f of their digits.
Particular properties are
• The remainder of `*R`*`*n`* modulo 3 is equal to the remainder of `*n`* modulo 3. Using 10`*a`* ≡ 1 (mod 3) for any `*a`* ≥ 0, `*n`* ≡ 0 (mod 3) ⇔ `*R`*`*n`* ≡ 0 (mod 3) ⇔ `*R`*`*n`* ≡ 0 (mod `*R`*3), `*n`* ≡ 1 (mod 3) ⇔ `*R`*`*n`* ≡ 1 (mod 3) ⇔ `*R`*`*n`* ≡ `*R`*1 ≡ 1 (mod `*R`*3), `*n`* ≡ 2 (mod 3) ⇔ `*R`*`*n`* ≡ 2 (mod 3) ⇔ `*R`*`*n`* ≡ `*R`*2 ≡ 11 (mod `*R`*3). Therefore, 3 | `*n`* ⇔ 3 | `*R`*`*n`* ⇔ `*R`*3 | `*R`*`*n`*.
• The remainder of `*R`*`*n`* modulo 9 is equal to the remainder of `*n`* modulo 9. Using 10`*a`* ≡ 1 (mod 9) for any `*a`* ≥ 0, `*n`* ≡ `*r`* (mod 9) ⇔ `*R`*`*n`* ≡ `*r`* (mod 9) ⇔ `*R`*`*n`* ≡ `*R`*`*r`* (mod `*R`*9), for 0 ≤ `*r`* < 9. Therefore, 9 | `*n`* ⇔ 9 | `*R`*`*n`* ⇔ `*R`*9 | `*R`*`*n`*.
>>>Algebra factorization of generalized repunit numbers
If `*b`* is a `F33f`_`[perfect power`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Perfect_power]`_`f (can be written as `*m`*`*n`*, with `*m`*, `*n`* integers, `*n`* > 1) differs from 1, then there is at most one repunit in base-`*b`*. If `*n`* is a `F33f`_`[prime power`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Prime_power]`_`f (can be written as `*p`*`*r`*, with `*p`* prime, `*r`* integer, `*p`*, `*r`* >0), then all repunit in base-`*b`* are not prime aside from `*Rp`* and `*R2`*. `*Rp`* can be either prime or composite, the former examples, `*b`* = −216, −128, 4, 8, 16, 27, 36, 100, 128, 256, etc., the latter examples, `*b`* = −243, −125, −64, −32, −27, −8, 9, 25, 32, 49, 81, 121, 125, 144, 169, 196, 216, 225, 243, 289, etc., and `*R2`* can be prime (when `*p`* differs from 2) only if `*b`* is negative, a power of −2, for example, `*b`* = −8, −32, −128, −8192, etc., in fact, the `*R2`* can also be composite, for example, `*b`* = −512, −2048, −32768, etc. If `*n`* is not a prime power, then no base-`*b`* repunit prime exists, for example, `*b`* = 64, 729 (with `*n`* = 6), `*b`* = 1024 (with `*n`* = 10), and `*b`* = −1 or 0 (with `*n`* any natural number). Another special situation is `*b`* = −4`*k`*4, with `*k`* positive integer, which has the `F33f`_`[aurifeuillean factorization`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Aurifeuillean_factorization]`_`f, for example, `*b`* = −4 (with `*k`* = 1, then `*R2`* and `*R3`* are primes), and `*b`* = −64, −324, −1024, −2500, −5184, ... (with `*k`* = 2, 3, 4, 5, 6, ...), then no base-`*b`* repunit prime exists. It is also conjectured that when `*b`* is neither a perfect power nor −4`*k`*4 with `*k`* positive integer, then there are infinity many base-`*b`* repunit primes.
>>>The generalized repunit conjecture
A conjecture related to the generalized repunit primes:`:cite-ref-10[`F5bf`_`[9`#cite-note-10]`_`f]`:cite-ref-11[`F5bf`_`[10`#cite-note-11]`_`f] (the conjecture predicts where is the next `F33f`_`[generalized Mersenne prime`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Generalized_Mersenne_prime]`_`f, if the conjecture is true, then there are infinitely many repunit primes for all bases b {\\displaystyle b} )
For any integer b {\\displaystyle b} , which satisfies the conditions:
1. | b | > 1 {\\displaystyle |b|>1} .
2. b {\\displaystyle b} is not a `F33f`_`[perfect power`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Perfect_power]`_`f. (since when b {\\displaystyle b} is a perfect r {\\displaystyle r} th power, it can be shown that there is at most one n {\\displaystyle n} value such that b n − − 1 b − − 1 {\\displaystyle {\\frac {b^{n}-1}{b-1}}} is prime, and this n {\\displaystyle n} value is r {\\displaystyle r} itself or a `F33f`_`[root`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Nth_root]`_`f of r {\\displaystyle r} )
3. b {\\displaystyle b} is not in the form − − 4 k 4 {\\displaystyle -4k^{4}} . (if so, then the number has `F33f`_`[aurifeuillean factorization`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Aurifeuillean_factorization]`_`f)
has generalized repunit primes of the form
R p ( b ) = b p − − 1 b − − 1 {\\displaystyle R_{p}(b)={\\frac {b^{p}-1}{b-1}}}
for prime p {\\displaystyle p} , the prime numbers will be distributed near the best fit line
Y = G ⋅ ⋅ log | b | ( log | b | ( R ( b ) ( n ) ) ) + C , {\\displaystyle Y=G\\cdot \\log _{|b|}\\left(\\log _{|b|}\\left(R_{(b)}(n)\\right)\\right)+C,}
where limit n → → ∞ ∞ {\\displaystyle n\\rightarrow \\infty } , G = 1 e γ γ = 0.561459483566... {\\displaystyle G={\\frac {1}{e^{\\gamma }}}=0.561459483566...}
and there are about
( log e ( N ) + m ⋅ ⋅ log e ( 2 ) ⋅ ⋅ log e ( log e ( N ) ) + 1 N − − δ δ ) ⋅ ⋅ e γ γ log e ( | b | ) {\\displaystyle \\left(\\log _{e}(N)+m\\cdot \\log _{e}(2)\\cdot \\log _{e}{\\big (}\\log _{e}(N){\\big )}+{\\frac {1}{\\sqrt {N}}}-\\delta \\right)\\cdot {\\frac {e^{\\gamma }}{\\log _{e}(|b|)}}}
base-`*b`* repunit primes less than `*N`*.
• e {\\displaystyle e} is the `F33f`_`[base of natural logarithm`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=E_(mathematical_constant)]`_`f.
• γ γ {\\displaystyle \\gamma } is `F33f`_`[Euler–Mascheroni constant`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Euler–Mascheroni_constant]`_`f.
• log | b | {\\displaystyle \\log _{|b|}} is the `F33f`_`[logarithm`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Logarithm]`_`f in `F33f`_`[base`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Base_of_a_logarithm]`_`f | b | {\\displaystyle |b|}
• R ( b ) ( n ) {\\displaystyle R_{(b)}(n)} is the n {\\displaystyle n} th generalized repunit prime in base`*b`* (with prime `*p`*)
• C {\\displaystyle C} is a data fit constant which varies with b {\\displaystyle b} .
• δ δ = 1 {\\displaystyle \\delta =1} if b > 0 {\\displaystyle b>0} , δ δ = 1.6 {\\displaystyle \\delta =1.6} if b < 0 {\\displaystyle b<0} .
• m {\\displaystyle m} is the largest natural number such that − − b {\\displaystyle -b} is a 2 m − − 1 {\\displaystyle 2^{m-1}} th power.
We also have the following 3 properties:
1. The number of prime numbers of the form b n − − 1 b − − 1 {\\displaystyle {\\frac {b^{n}-1}{b-1}}} (with prime p {\\displaystyle p} ) less than or equal to n {\\displaystyle n} is about e γ γ ⋅ ⋅ log | b | ( log | b | ( n ) ) {\\displaystyle e^{\\gamma }\\cdot \\log _{|b|}{\\big (}\\log _{|b|}(n){\\big )}} .
2. The expected number of prime numbers of the form b n − − 1 b − − 1 {\\displaystyle {\\frac {b^{n}-1}{b-1}}} with prime p {\\displaystyle p} between n {\\displaystyle n} and | b | ⋅ ⋅ n {\\displaystyle |b|\\cdot n} is about e γ γ {\\displaystyle e^{\\gamma }} .
3. The probability that number of the form b n − − 1 b − − 1 {\\displaystyle {\\frac {b^{n}-1}{b-1}}} is prime (for prime p {\\displaystyle p} ) is about e γ γ p ⋅ ⋅ log e ( | b | ) {\\displaystyle {\\frac {e^{\\gamma }}{p\\cdot \\log _{e}(|b|)}}} .
>>History
Although they were not then known by that name, repunits in base-10 were studied by many mathematicians during the nineteenth century in an effort to work out and predict the cyclic patterns of `F33f`_`[repeating decimals`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Repeating_decimal]`_`f.`:cite-ref-dickson1999-12-0[`F5bf`_`[11`#cite-note-dickson1999-12]`_`f]
It was found very early on that for any prime `*p`* greater than 5, the `F33f`_`[period`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Repeating_decimal]`_`f of the decimal expansion of 1/`*p`* is equal to the length of the smallest repunit number that is divisible by `*p`*. Tables of the period of reciprocal of primes up to 60,000 had been published by 1860 and permitted the `F33f`_`[factorization`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Integer_factorization]`_`f by such mathematicians as Reuschle of all repunits up to `*R16`* and many larger ones. By 1880, even `*R17`* to `*R36`* had been factored`:cite-ref-dickson1999-12-1[`F5bf`_`[11`#cite-note-dickson1999-12]`_`f] and it is curious that, though `F33f`_`[Édouard Lucas`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Édouard_Lucas]`_`f showed no prime below three million had period `F33f`_`[nineteen`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=19_(number)]`_`f, there was no attempt to test any repunit for primality until early in the twentieth century. The American mathematician Oscar Hoppe proved `*R19`* to be prime in 1916,`:cite-ref-13[`F5bf`_`[12`#cite-note-13]`_`f] and Lehmer and Kraitchik independently found `*R23`* to be prime in 1929.
Further advances in the study of repunits did not occur until the 1960s, when computers allowed many new factors of repunits to be found and the gaps in earlier tables of prime periods corrected. `*R317`* was found to be a `F33f`_`[probable prime`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Probable_prime]`_`f circa 1966 and was proved prime eleven years later, when `*R1031`* was shown to be the only further possible prime repunit with fewer than ten thousand digits. It was proven prime in 1986, but searches for further prime repunits in the following decade consistently failed. However, there was a major side-development in the field of generalized repunits, which produced a large number of new primes and probable primes.
Since 1999, four further probably prime repunits have been found, but it is unlikely that any of them will be proven prime in the foreseeable future because of their huge size.
The `F33f`_`[Cunningham project`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Cunningham_project]`_`f endeavours to document the integer factorizations of (among other numbers) the repunits to base 2, 3, 5, 6, 7, 10, 11, and 12.
>>Demlo numbers
`F33f`_`[D. R. Kaprekar`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=D._R._Kaprekar]`_`f has defined Demlo numbers as concatenation of a left, middle and right part, where the left and right part must be of the same length (up to a possible leading zero to the left) and must add up to a repdigit number, and the middle part may contain any additional number of this repeated digit.`:cite-ref-14[`F5bf`_`[13`#cite-note-14]`_`f] They are named after Demlo railway station (now called `F33f`_`[Dombivili`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Dombivli_railway_station]`_`f) 30 miles from Bombay on the then `F33f`_`[G.I.P. Railway`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=G.I.P._Railway]`_`f, where Kaprekar started investigating them. He calls `*Wonderful Demlo numbers`* those of the form 1, 121, 12321, 1234321, ..., 12345678987654321. The fact that these are the squares of the repunits has led some authors to call Demlo numbers the infinite sequence of these,`:cite-ref-15[`F5bf`_`[14`#cite-note-15]`_`f] 1, 121, 12321, ..., 12345678987654321, 1234567900987654321, 123456790120987654321, ..., (sequence A002477 in the `F33f`_`[OEIS`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=On-Line_Encyclopedia_of_Integer_Sequences]`_`f), although one can check these are not Demlo numbers for `*p`* = 10, 19, 28, ...
>>See also
• `F33f`_`[All one polynomial`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=All_one_polynomial]`_`f — Another generalization
• `F33f`_`[Goormaghtigh conjecture`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Goormaghtigh_conjecture]`_`f
• `F33f`_`[Repeating decimal`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Repeating_decimal]`_`f
• `F33f`_`[Repdigit`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Repdigit]`_`f
• `F33f`_`[Wagstaff prime`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Wagstaff_prime]`_`f — can be thought of as repunit primes with `F33f`_`[negative base`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Negative_base]`_`f b = − − 2 {\\displaystyle b=-2}
>>Footnotes
>>>Notes
`:cite-note-2`!note 1.`! `F0af`_`[↑`#cite-ref-2]`_`f Albert H. Beiler coined the term "repunit number" as follows:A number which consists of a repeated of a single digit is sometimes called a monodigit number, and for convenience the author has used the term "repunit number" (repeated unit) to represent monodigit numbers consisting solely of the digit 1.`:cite-ref-1[`F5bf`_`[1`#cite-note-1]`_`f]
>>>References
`:cite-note-1`!1.`! `F0af`_`[↑`#cite-ref-1]`_`f `F33f`_`[Beiler 2013`#citerefbeiler2013]`_`f, pp. 83
`:cite-note-3`!2.`! `F0af`_`[↑`#cite-ref-3]`_`f For more information, see Factorization of repunit numbers.
`:cite-note-4`!3.`! `F0af`_`[↑`#cite-ref-4]`_`f Maksym Voznyy, `*New PRP Repunit R(270343)`*
`:cite-note-5`!4.`! `F0af`_`[↑`#cite-ref-5]`_`f `:citerefsloane-a004023`a`F33f`_`[Sloane, N. J. A.`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Neil_Sloane]`_`f (ed.). "Sequence A004023 (Indices of prime repunits: numbers n such that 11...111 (with n 1's) = (10^n - 1)/9 is prime.)". `*The `F33f`_`[On-Line Encyclopedia of Integer Sequences`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=On-Line_Encyclopedia_of_Integer_Sequences]`_`f`*. OEIS Foundation.
`:cite-note-6`!5.`! `F0af`_`[↑`#cite-ref-6]`_`f "PrimePage Primes: R(49081)". `*PrimePage Primes`*. 2022-03-21. Retrieved 2022-03-31.
`:cite-note-7`!6.`! `F0af`_`[↑`#cite-ref-7]`_`f "PrimePage Primes: R(86453)". `*PrimePage Primes`*. 2023-05-16. Retrieved 2023-05-16.
`:cite-note-8`!7.`! `F0af`_`[↑`#cite-ref-8]`_`f "PrimePage Primes: R(109297)". `*PrimePage Primes`*. 2025-05-27. Retrieved 2025-05-27.
`:cite-note-9`!8.`! `F0af`_`[↑`#cite-ref-9]`_`f `:citerefchris-caldwell`aChris Caldwell. "repunit". `*The Prime Glossary`*. `F33f`_`[Prime Pages`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Prime_Pages]`_`f.
`:cite-note-10`!9.`! `F0af`_`[↑`#cite-ref-10]`_`f Deriving the Wagstaff Mersenne Conjecture
`:cite-note-11`!10.`! `F0af`_`[↑`#cite-ref-11]`_`f Generalized Repunit Conjecture
`:cite-note-dickson1999-12`!11.`! `F0af`_`[↑`#cite-ref-dickson1999-12-0]`_`f `F33f`_`[Dickson & Cresse 1999`#citerefdicksoncresse1999]`_`f, pp. 164–167
`:cite-note-13`!12.`! `F0af`_`[↑`#cite-ref-13]`_`f `F33f`_`[Francis 1988`#citereffrancis1988]`_`f, pp. 240–246
`:cite-note-14`!13.`! `F0af`_`[↑`#cite-ref-14]`_`f Kaprekar `F33f`_`[1938a`#citerefkaprekar1938a]`_`f, `F33f`_`[1938b`#citerefkaprekar1938b]`_`f, `F33f`_`[Gunjikar & Kaprekar 1939`#citerefgunjikarkaprekar1939]`_`f
`:cite-note-15`!14.`! `F0af`_`[↑`#cite-ref-15]`_`f `:reference-mathworld-demlo-number`a`F33f`_`[Weisstein, Eric W.`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Eric_W._Weisstein]`_`f "Demlo Number". `*`F33f`_`[MathWorld`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=MathWorld]`_`f`*.
>>References
• `:citerefbeiler2013`aBeiler, Albert H. (2013) [1964], `*Recreations in the Theory of Numbers: The Queen of Mathematics Entertains`*, Dover Recreational Math (2nd Revised ed.), New York: Dover Publications, `F33f`_`[ISBN`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=ISBN_(identifier)]`_`f 978-0-486-21096-4
• `:citerefdicksoncresse1999`a`F33f`_`[Dickson, Leonard Eugene`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Leonard_Eugene_Dickson]`_`f; Cresse, G.H. (1999), `*History of the Theory of Numbers`*, Volume I: Divisibility and primality (2nd Reprinted ed.), Providence, RI: AMS Chelsea Publishing, `F33f`_`[ISBN`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=ISBN_(identifier)]`_`f 978-0-8218-1934-0
• `:citereffrancis1988`aFrancis, Richard L. (1988), "Mathematical Haystacks: Another Look at Repunit Numbers", `*The College Mathematics Journal`*, `!19`! (3): 240–246, `F33f`_`[doi`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Doi_(identifier)]`_`f:10.1080/07468342.1988.11973120
• `:citerefgunjikarkaprekar1939`aGunjikar, K. R.; `F33f`_`[Kaprekar, D. R.`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=D._R._Kaprekar]`_`f (1939), "Theory of Demlo numbers" (PDF), `*Journal of the University of Bombay`*, `!VIII`! (3): 3–9
• `:citerefkaprekar1938a`a`F33f`_`[Kaprekar, D. R.`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=D._R._Kaprekar]`_`f (1938a), "On Wonderful Demlo numbers", `*The Mathematics Student`*, `!6`!: 68
• `:citerefkaprekar1938b`a`F33f`_`[Kaprekar, D. R.`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=D._R._Kaprekar]`_`f (1938b), "Demlo numbers", `*J. Phys. Sci. Univ. Bombay`*, `!VII`! (3)
• `:citerefkaprekar1948`a`F33f`_`[Kaprekar, D. R.`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=D._R._Kaprekar]`_`f (1948), `*Demlo numbers`*, Devlali, India: Khareswada
• `:citerefribenboim1996`a`F33f`_`[Ribenboim, Paulo`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Paulo_Ribenboim]`_`f (1996-02-02), `*The New Book of Prime Number Records`*, Computers and Medicine (3rd ed.), New York: Springer, `F33f`_`[ISBN`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=ISBN_(identifier)]`_`f 978-0-387-94457-9
• `:citerefyates1982`a`F33f`_`[Yates, Samuel`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Samuel_Yates]`_`f (1982), `*Repunits and repetends`*, FL: Delray Beach, `F33f`_`[ISBN`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=ISBN_(identifier)]`_`f 978-0-9608652-0-8
>>External links
• `:reference-mathworld-repunit`a`:citerefweisstein`a`F33f`_`[Weisstein, Eric W.`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Eric_W._Weisstein]`_`f "Repunit". `*`F33f`_`[MathWorld`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=MathWorld]`_`f`*.
• The main tables of the Cunningham project.
• Repunit at `F33f`_`[The Prime Pages`:/page/wikibook/entry.mu`zim=wikipedia_en_all_nopic_2025-08.zim|entry_path=Prime_Pages]`_`f by Chris Caldwell.
• Repunits and their prime factors at World!Of Numbers.
• Prime generalized repunits of at least 1000 decimal digits by Andy Steward
• Repunit Primes Project Giovanni Di Maria's repunit primes page.
• Smallest odd prime p such that (b^p-1)/(b-1) and (b^p+1)/(b+1) is prime for bases 2<=b<=1024
• Factorization of repunit numbers
• Generalized repunit primes in base -50 to 50
`c`F0af`_`[↑ Back to top`#top]`_`f`a